// HSS.Forms.Docking.FloatWindowCollection.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license
// http://www.opensource.org/licenses/mit-license.html
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       FloatWindowCollection.cs
// Author:     HSS\gbanta
// Created:    08/12/2010
// Modified:   12/04/2010
// ----------------------------------------------------------------------------
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace HSS.Forms.Docking
{
	#region FloatWindowCollection
	/// <summary>
	/// FloatWindowCollection
	/// </summary>
	public class FloatWindowCollection : ReadOnlyCollection<FloatWindow>
	{
		internal FloatWindowCollection()
            : base(new List<FloatWindow>())
		{
		}

		internal int Add(FloatWindow fw)
		{
			if (Items.Contains(fw))
				return Items.IndexOf(fw);

			Items.Add(fw);
            return Count - 1;
		}

		internal void Dispose()
		{
			for (int i=Count - 1; i>=0; i--)
				this[i].Close();
		}

		internal void Remove(FloatWindow fw)
		{
			Items.Remove(fw);
		}

		internal void BringWindowToFront(FloatWindow fw)
		{
			Items.Remove(fw);
			Items.Add(fw);
		}
	}
	#endregion
}